#!/bin/sh
#
# Taken and modified from:
# https://letsencrypt.org/getting-started/#writing-your-own-renewal-script
#
# meant to be run as root...
#
service nginx stop
/usr/local/src/letsencrypt/letsencrypt-auto renew -nvv --standalone > /var/log/letsencrypt/renew.log 2>&1
LE_STATUS=$?
service nginx start
if [ "$LE_STATUS" != 0 ]; then
    echo Automated renewal failed:
    cat /var/log/letsencrypt/renew.log
    exit 1
fi
